package minNumBooths;

import java.util.Arrays;

public class Solution {
    public int minNumBooths(String[] demand) {
        int[] map = new int[26];
        int ans = 0;
        for (String de: demand) {
            for (int i = 0; i < map.length; i++) {
                map[i] =Math.max(get((char)( i+'a'),de),map[i]);
            }
        }
        return Arrays.stream(map).sum();
    }
    private int get(char c,String s) {
        int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == c) {
                ans++;
            }
        }
        return ans;
    }
}
